#include "generatedatathread.h"

GenerateDataThread::GenerateDataThread(QSemaphore* semaphore, QObject* parent)
    :QThread(parent){
    m_semaphore = semaphore;
}

GenerateDataThread::~GenerateDataThread()
{
    m_timer->stop();
    delete m_timer;
}

void GenerateDataThread::run()
{
    m_timer = new QTimer();
    connect(m_timer, &QTimer::timeout, this, &GenerateDataThread::generateData);
    m_timer->start(1000);
    exec();
}

void GenerateDataThread::generateData()
{
    m_semaphore->release();
}
